from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema, OpenApiParameter, OpenApiExample
from rest_framework.response import Response
from rest_framework.views import APIView


# Create your views here.


class Celery(APIView):
    @extend_schema(description='celery测试',
                   parameters=[OpenApiParameter(name='id', required=False, location=OpenApiParameter.QUERY,
                                                description='主键id', type=OpenApiTypes.INT, examples=[
                           OpenApiExample(
                               'Example 1',
                               summary='案例一',
                               description='案例一所属id',
                               value='21'
                           ),
                           OpenApiExample(
                               'Example 2',
                               summary='案例二',
                               description='案例二所属id',
                               value='22'
                           )
                       ]),
                               OpenApiParameter(name='team', description='所属团队', required=True,
                                                type=OpenApiTypes.STR)],
                   )
    def get(self, request):
        # from celery_test.tasks import add
        # result = add.dealy(3,7)
        return Response('celery 测试')
